package edu.hunau.cxb19.oop.class08.abstracts;

 

/**
 * 描述平面中的图形
 * 
 * @author hb
 *
 *         2020-03-04 14:53:15
 */
public abstract class Shape {
	
	private Point location;

	/**
	 * @param location
	 */
	public Shape(Point location) {
		this.location = location;
	}

	/**
	 * @return the location
	 */
	public Point getLocation() {
		return location;
	}

	/**
	 * @param location the location to set
	 */
	public void setLocation(Point location) {
		this.location = location;
	}

	public Shape() {

	}

	/**
	 * 声明了一个抽象方法，对于Shape子类必须对该area方法提供具体的实现
	 * 
	 * @return
	 */
	public abstract double area();
	
	/**
	 * 判定一个点是否在图形的内部
	 * 
	 * @param p
	 * @return
	 */
	public abstract boolean contains(Point p) ;

	public boolean contains(int x, int y) {
		return this.contains(new Point(x, y));
	}

}
